.class public Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;
.super Lcom/vividsolutions/jts/geomgraph/index/EdgeSetIntersector;
.source "SimpleMCSweepLineIntersector.java"


# instance fields
.field events:Ljava/util/List;

.field nOverlaps:I


# direct methods
.method public constructor <init>()V
    .locals 1

    .line 66
    invoke-direct {p0}, Lcom/vividsolutions/jts/geomgraph/index/EdgeSetIntersector;-><init>()V

    .line 58
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->events:Ljava/util/List;

    return-void
.end method

.method private add(Lcom/vividsolutions/jts/geomgraph/Edge;Ljava/lang/Object;)V
    .locals 12

    .line 103
    invoke-virtual {p1}, Lcom/vividsolutions/jts/geomgraph/Edge;->getMonotoneChainEdge()Lcom/vividsolutions/jts/geomgraph/index/MonotoneChainEdge;

    move-result-object p1

    .line 104
    invoke-virtual {p1}, Lcom/vividsolutions/jts/geomgraph/index/MonotoneChainEdge;->getStartIndexes()[I

    move-result-object v0

    const/4 v1, 0x0

    .line 105
    :goto_0
    array-length v2, v0

    add-int/lit8 v2, v2, -0x1

    if-ge v1, v2, :cond_0

    .line 106
    new-instance v2, Lcom/vividsolutions/jts/geomgraph/index/MonotoneChain;

    invoke-direct {v2, p1, v1}, Lcom/vividsolutions/jts/geomgraph/index/MonotoneChain;-><init>(Lcom/vividsolutions/jts/geomgraph/index/MonotoneChainEdge;I)V

    .line 107
    new-instance v9, Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;

    invoke-virtual {p1, v1}, Lcom/vividsolutions/jts/geomgraph/index/MonotoneChainEdge;->getMinX(I)D

    move-result-wide v5

    const/4 v7, 0x0

    move-object v3, v9

    move-object v4, p2

    move-object v8, v2

    invoke-direct/range {v3 .. v8}, Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;-><init>(Ljava/lang/Object;DLcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;Ljava/lang/Object;)V

    .line 108
    iget-object v3, p0, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->events:Ljava/util/List;

    invoke-interface {v3, v9}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 109
    iget-object v10, p0, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->events:Ljava/util/List;

    new-instance v11, Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;

    invoke-virtual {p1, v1}, Lcom/vividsolutions/jts/geomgraph/index/MonotoneChainEdge;->getMaxX(I)D

    move-result-wide v5

    move-object v3, v11

    move-object v7, v9

    invoke-direct/range {v3 .. v8}, Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;-><init>(Ljava/lang/Object;DLcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;Ljava/lang/Object;)V

    invoke-interface {v10, v11}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_0
    return-void
.end method

.method private add(Ljava/util/List;)V
    .locals 1

    .line 87
    invoke-interface {p1}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object p1

    :goto_0
    invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 88
    invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/vividsolutions/jts/geomgraph/Edge;

    .line 90
    invoke-direct {p0, v0, v0}, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->add(Lcom/vividsolutions/jts/geomgraph/Edge;Ljava/lang/Object;)V

    goto :goto_0

    :cond_0
    return-void
.end method

.method private add(Ljava/util/List;Ljava/lang/Object;)V
    .locals 1

    .line 95
    invoke-interface {p1}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object p1

    :goto_0
    invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 96
    invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/vividsolutions/jts/geomgraph/Edge;

    .line 97
    invoke-direct {p0, v0, p2}, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->add(Lcom/vividsolutions/jts/geomgraph/Edge;Ljava/lang/Object;)V

    goto :goto_0

    :cond_0
    return-void
.end method

.method private computeIntersections(Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;)V
    .locals 3

    const/4 v0, 0x0

    .line 132
    iput v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->nOverlaps:I

    .line 133
    invoke-direct {p0}, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->prepareEvents()V

    .line 135
    :goto_0
    iget-object v1, p0, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->events:Ljava/util/List;

    invoke-interface {v1}, Ljava/util/List;->size()I

    move-result v1

    if-ge v0, v1, :cond_1

    .line 137
    iget-object v1, p0, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->events:Ljava/util/List;

    invoke-interface {v1, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;

    .line 138
    invoke-virtual {v1}, Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;->isInsert()Z

    move-result v2

    if-eqz v2, :cond_0

    .line 139
    invoke-virtual {v1}, Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;->getDeleteEventIndex()I

    move-result v2

    invoke-direct {p0, v0, v2, v1, p1}, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->processOverlaps(IILcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;)V

    :cond_0
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    :cond_1
    return-void
.end method

.method private prepareEvents()V
    .locals 3

    .line 120
    iget-object v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->events:Ljava/util/List;

    invoke-static {v0}, Ljava/util/Collections;->sort(Ljava/util/List;)V

    const/4 v0, 0x0

    .line 121
    :goto_0
    iget-object v1, p0, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->events:Ljava/util/List;

    invoke-interface {v1}, Ljava/util/List;->size()I

    move-result v1

    if-ge v0, v1, :cond_1

    .line 123
    iget-object v1, p0, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->events:Ljava/util/List;

    invoke-interface {v1, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;

    .line 124
    invoke-virtual {v1}, Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;->isDelete()Z

    move-result v2

    if-eqz v2, :cond_0

    .line 125
    invoke-virtual {v1}, Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;->getInsertEvent()Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;

    move-result-object v1

    invoke-virtual {v1, v0}, Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;->setDeleteEventIndex(I)V

    :cond_0
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    :cond_1
    return-void
.end method

.method private processOverlaps(IILcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;)V
    .locals 4

    .line 146
    invoke-virtual {p3}, Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;->getObject()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/vividsolutions/jts/geomgraph/index/MonotoneChain;

    :goto_0
    if-ge p1, p2, :cond_2

    .line 153
    iget-object v1, p0, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->events:Ljava/util/List;

    invoke-interface {v1, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;

    .line 154
    invoke-virtual {v1}, Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;->isInsert()Z

    move-result v2

    if-eqz v2, :cond_1

    .line 155
    invoke-virtual {v1}, Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;->getObject()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/vividsolutions/jts/geomgraph/index/MonotoneChain;

    .line 158
    iget-object v3, p3, Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;->edgeSet:Ljava/lang/Object;

    if-eqz v3, :cond_0

    iget-object v1, v1, Lcom/vividsolutions/jts/geomgraph/index/SweepLineEvent;->edgeSet:Ljava/lang/Object;

    if-eq v3, v1, :cond_1

    .line 159
    :cond_0
    invoke-virtual {v0, v2, p4}, Lcom/vividsolutions/jts/geomgraph/index/MonotoneChain;->computeIntersections(Lcom/vividsolutions/jts/geomgraph/index/MonotoneChain;Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;)V

    .line 160
    iget v1, p0, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->nOverlaps:I

    add-int/lit8 v1, v1, 0x1

    iput v1, p0, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->nOverlaps:I

    :cond_1
    add-int/lit8 p1, p1, 0x1

    goto :goto_0

    :cond_2
    return-void
.end method


# virtual methods
.method public computeIntersections(Ljava/util/List;Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;Z)V
    .locals 0

    if-eqz p3, :cond_0

    const/4 p3, 0x0

    .line 72
    invoke-direct {p0, p1, p3}, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->add(Ljava/util/List;Ljava/lang/Object;)V

    goto :goto_0

    .line 74
    :cond_0
    invoke-direct {p0, p1}, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->add(Ljava/util/List;)V

    .line 75
    :goto_0
    invoke-direct {p0, p2}, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->computeIntersections(Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;)V

    return-void
.end method

.method public computeIntersections(Ljava/util/List;Ljava/util/List;Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;)V
    .locals 0

    .line 80
    invoke-direct {p0, p1, p1}, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->add(Ljava/util/List;Ljava/lang/Object;)V

    .line 81
    invoke-direct {p0, p2, p2}, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->add(Ljava/util/List;Ljava/lang/Object;)V

    .line 82
    invoke-direct {p0, p3}, Lcom/vividsolutions/jts/geomgraph/index/SimpleMCSweepLineIntersector;->computeIntersections(Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;)V

    return-void
.end method
